package com.tgit.sso.core.common;

import java.io.Serializable;
/**
 * 响应体
 * @author 范再军
 * 2018年9月12日
 * @param <T>
 */
public class ResponseT<T> implements Serializable {

	private static final long serialVersionUID = -8162599606586306870L;
	
	public static final int SUCCESS_CODE = 200;
	public static final int TOKEN_CODE = 1000;
	public static final int LOGOUT_CODE = 1001;
	public static final int SERVER_CODE = 1002;
	public static final int EMAIL_CODE = 1003;
	public static final int FAIL_CODE = 500;
	public static final ResponseT<String> SUCCESS = new ResponseT<String>(null);
	public static final ResponseT<String> FAIL = new ResponseT<String>(FAIL_CODE, null);
	
	private int code;
	private String field="";
	private String msg="";
	private T data;
	public String getField() {
		return field;
	}
	public void setField(String field) {
		this.field = field;
	}
	
	public ResponseT(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	public ResponseT(int code, String field, String msg) {
		this.field=field;
		this.code = code;
		this.msg = msg;
	}
	public ResponseT(T data) {
		this.code = SUCCESS_CODE;
		this.data = data;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}

}
